home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / DDJMAG / DDJ9203.ZIP / OOPASM.ZIP / SYSTEM.ASM < prev    next >
Assembly Source File  |  1990-07-14  |  4KB  |  166 lines

  1.     .MODEL    SMALL
  2.  
  3.     INCLUDE    equates.inc
  4.     INCLUDE    instance.inc
  5.     INCLUDE    messages.inc
  6.     INCLUDE    objects.inc
  7.  
  8.     UR    EQU    9            ;Upper row
  9.     LC    EQU    10            ;Left column
  10.     LR    EQU    15            ;Lower row
  11.     RC    EQU    60            ;Right column
  12.     MR    EQU    LR-(RowOffset+1)    ;Mouse row
  13.     MC    EQU    LC+ColOffset+1        ;Mouse column
  14.  
  15. IF1
  16.     INCLUDE    macros.mac
  17.     INCLUDE    objects.mac
  18. ENDIF
  19.  
  20.     EXTRN    clrNextContext:NEAR
  21.     EXTRN    hideMouseCursor:NEAR
  22.     EXTRN    prtString:NEAR
  23.     EXTRN    sendMsg:NEAR
  24.  
  25.     EXTRN    Dialog:WORD
  26.     EXTRN    Dir:WORD
  27.     EXTRN    DlgMenu:WORD
  28.     EXTRN    DosError:WORD
  29.     EXTRN    Exec:WORD
  30.     EXTRN    File:WORD
  31.     EXTRN    Hardware:WORD
  32.     EXTRN    Help:WORD
  33.     EXTRN    Master:WORD
  34.     EXTRN    MenuBar:WORD
  35.     EXTRN    Self:WORD
  36.     EXTRN    Screen:WORD
  37.     EXTRN    Video:WORD
  38.  
  39.  
  40.     .CODE
  41.  
  42. COMMENT    %
  43. ==============================================================================
  44. Resets the video display.
  45.  
  46. =============================================================================%
  47. resetVideo    PROC    NEAR
  48.     send        Video,Reset        ;Reset video 
  49.     ret
  50. resetVideo    ENDP
  51.  
  52.  
  53.  
  54. IF Dbug
  55.     PUBLIC suspendPgm
  56. ENDIF
  57. COMMENT    %
  58. ==============================================================================
  59. Displays the exit text message when before suspending program execution.
  60.  
  61. =============================================================================%
  62. suspendPgm    PROC    NEAR
  63.     lea        si,ExitMsg        ;Get addr of msg text
  64.     xor        dx,dx            ;Cursor position
  65.     mov        bl,07h            ;Text color
  66.     call        prtString        ;Display the string
  67.     send        Exec,Execute        ;Load and execute DOS shell
  68.     setInst        ?ReadDir,Nil,Dir,2    ;Must re-read directory
  69.     ret
  70. suspendPgm    ENDP
  71.  
  72.  
  73.  
  74. COMMENT    %
  75. ==============================================================================
  76. Refreshes the video display, and enters the top-level executive driver.
  77.  
  78. =============================================================================%
  79. initSys    PROC    NEAR
  80.     send        Video,Init        ;Initialize video 
  81.     send        File,Init        ;Save program's path info
  82.     send        DosError,Init        ;Verify error handler exists
  83.     send        Screen,Init        ;Initialize objects' color 
  84.     send        Screen,Refresh        ;Refresh screen
  85.     send        Help,Refresh        ;Refresh help menu
  86.     send        Hardware,Init        ;Initialize hardware cursor
  87.     send        MenuBar,Refresh        ;Refresh menubar
  88.     send        MenuBar,Init        ;Start executive loop
  89.     ret
  90. initSys    ENDP
  91.  
  92.  
  93.  
  94. COMMENT    %
  95. ==============================================================================
  96. Returns control to the operating system.
  97.  
  98. =============================================================================%
  99. returnToOS    PROC    NEAR
  100.     exit                    ;Return to DOS
  101. returnToOS    ENDP
  102.  
  103.  
  104.  
  105.     .DATA
  106.  
  107. SystemText    DB    "Session termination options:",0
  108. ExitMsg        DB    "Type EXIT to return.",0
  109.  
  110. defMenu        System,<" Quit Program "," Suspend Program "," Cancel ">
  111.  
  112. defMenuTbl    System,\
  113.     <System,Reset>,\
  114.     <System,Suspend>,\
  115.     <System,Clear>
  116.  
  117. defSlaveTbl    System,<DlgMenu>
  118.  
  119. defDispTbl    System,\
  120.     <0,0,3,0,0,0,0,System,Reset>,\
  121.     <0,75,3,0,0,0,0,DlgMenu,Prev>,\
  122.     <0,77,3,0,0,0,0,DlgMenu,Next>,\
  123.     <13,28,3,0,0,0,0,System,Select>,\
  124.     <0,Nil,1,MR,MC,MR+2,MC+44,System,Click>,\
  125.     <27,1,3,0,0,0,0,System,Clear>,\
  126.     <Nil,Nil,Nil,0,0,24,79,Hardware,Refresh>
  127.  
  128. defMsg    System,\
  129.     Clear,\
  130.     <,,clrNextContext>
  131.  
  132. defMsg    System,\
  133.     Reset,\
  134.     <resetVideo,hideMouseCursor,returnToOS>
  135.  
  136. defMsg    System,\
  137.     Init,\
  138.     <,,initSys>
  139.  
  140. defMsg    System,\
  141.     Suspend,\
  142.     <resetVideo,suspendPgm,initSys>
  143.  
  144. defObj    System,\
  145.     <Dialog,Master>,\
  146.     <Row1,1,UR,\
  147.     Col1,1,LC,\
  148.     Row2,1,LR,\
  149.     Col2,1,RC,\
  150.     Color,1,13h,\
  151.     Unused,1,Nil,\
  152.     TxtPtr,2,SystemText,\
  153.     InxPtr,2,0,\
  154.     MasterObj,2,Nil,\
  155.     DispTbl,2,SystemDispTbl,\
  156.     MenuPtr,2,SystemMenu,\
  157.     MenuTbl,2,SystemMenuTbl,\
  158.     SlaveTbl,2,SystemSlaveTbl>,\
  159.     <Refresh,Read,Select,Clear,Reset,Init,Suspend,Click>
  160.  
  161.  
  162.  
  163.  
  164.     END
  165. 
  166.